<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
        * {
            width: 100%;
            height: 100%;
        }

        body {
            width: 100%;
            height: 100%;
        }

        #box1 {
            width: 600px;
            height: 500px;
            margin: 0 auto;
            text-align: center;
        }

        button {
            width: 60px;
            height: 30px;
        }

        #box2 {
            width: 100px;
            height: 100px;
            margin: 20px auto;
            background-color: black;
        }
    </style>
</head>

<body>
    <div id="box1">
        <button onclick="ylt_w()">变宽</button>
        <button onclick="ylt_h()">变高</button>
        <button onclick="ylt_c()">变色</button>
        <button onclick="ylt_hide()">隐藏</button>
        <button onclick="ylt_reset()">重置</button>
        <div id="box2">
        </div>

    </div>
</body>
<script type="text/javascript">
    var ylt_r = document.getElementById("box2")
    // 变高
    function ylt_w() {
        ylt_r.style.width = "200px";
    }

    function ylt_h() {
        ylt_r.style.height = "200px";

    }

    function ylt_c() {
        ylt_r.style.background = 'red';

    }

    function ylt_hide() {
        ylt_r.style.visibility = "hidden";
    }

    function ylt_reset() {
        ylt_r.style = "background-color:blak; width:100px;height:100px;"
        }
</script>

</html>